package com.atguigu.srb.core.controller.admin;


import com.atguigu.common.results.R;
import com.atguigu.srb.core.pojo.entity.LendItem;
import com.atguigu.srb.core.service.LendItemService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 标的出借记录表 前端控制器
 * </p>
 *
 * @author Atguigu
 * @since 2022-10-24
 */
@RestController
@RequestMapping("/admin/core/lendItem")
public class AdminLendItemController {
    @Autowired
    LendItemService lendItemService;
    @ApiOperation("投资记录列表")
    @GetMapping("/lendItems/{lendId}")
    public R lendItems(@PathVariable("lendId")String lendId){
        List<LendItem> lendItems = lendItemService.list(new LambdaQueryWrapper<LendItem>()
                .eq(LendItem::getLendId, lendId)
                .ne(LendItem::getStatus, 0));
        return R.success().data("items",lendItems);
    }

}

